# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Luis Aleman Vazquez <luisv@tuta.io>

pkgname=cliphist
pkgver=0.4.0
pkgrel=2
epoch=1
pkgdesc='wayland clipboard manager'
arch=(i686 loong64 x86_64)
url="https://github.com/sentriz/$pkgname"
license=(GPL3)
depends=(glibc
         wl-clipboard)
makedepends=(go)
optdepends=('xdg-utils: image and mime inferance')
_archive="$pkgname-$pkgver"
source=("$url/archive/v$pkgver/$_archive.tar.gz")
sha256sums=('e492d6cd4e1bfc77582e32e25a3683687f2ff22e8d390cd06e14d21d7bef32c2')

build() {
	cd "$_archive"
	export CGO_CPPFLAGS="$CPPFLAGS"
	export CGO_CFLAGS="$CFLAGS"
	export CGO_CXXFLAGS="$CXXFLAGS"
	export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
	go build \
		-ldflags "-linkmode external -extldflags '$LDFLAGS'" \
		-o $pkgname
}

package() {
	cd "$_archive"
	install -Dm0755 -t "$pkgdir/usr/bin/" $pkgname
}
